package com.sangeng.controller;


import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/test")
public class TestController {

    @RequestMapping("/hello")
    public String test(){
        System.out.println("hello");
        return "/success.jsp";
    }


    @RequestMapping("/testPath")
    public String testPath(){
        System.out.println("testPath");
        return "/success.jsp";
    }



    @PostMapping("/testMethod")
    public String testMethod(){
        System.out.println("testMethod");
        return "/success.jsp";
    }



    @RequestMapping(value = "/testparams",method = RequestMethod.GET,params = {"code!=1"})
    public String testParams(){
        System.out.println("params");
        return "/success.jsp";
    }

    /**
     * 限制请求头
     * @return
     */
    @RequestMapping(value = "/testHeaders",method = RequestMethod.GET,headers = "deviceType")
    public String testHeaders(){
        System.out.println("testHeaders");
        return "/success.jsp";
    }


    /**
     * 限制请求头的content-type
     * @return
     */
    @RequestMapping(value = "/consumes",method = RequestMethod.GET,consumes = "multipart/from-data")
    public String consumes(){
        System.out.println("testHeaders");
        return "/success.jsp";
    }

}
